import clutter, gobject, os 
from touchable import TouchActor, LongTouchActor

class ImageButton(TouchActor, LongTouchActor, clutter.Texture):
    def __init__(self, path=None, uri=None, callback=None, long_cb=None, release_cb=None):
        if long_cb is None:
            TouchActor.__init__(self, simple_cb=callback, release_cb=release_cb)
        else:            
            LongTouchActor.__init__(self, simple_cb=callback, long_cb=long_cb)

        if path is not None:
            if os.path.isfile(path):
                clutter.Texture.__init__(self, path)
            else:
                print "Error: File %s does not exist" %path
                clutter.Texture.__init__(self)
        else:
            clutter.Texture.__init__(self)
